/**
 * Copyright (C) 2015-2018 IQIYI
 * All rights reserved.
 *
 * Author     : 王海斌
 * E-mail     : wanghaibin@qiyi.com
 * Version    :
 * Date       : Tue 08 Dec 2020 09:43:41 AM CST
 * Destription: 测试一些常用的宏定义
 */
#include <stdio.h>

// 将单个字母转换为大写
#define UPCASE( c )(((c)>='a'&&(c)<='z')?((c)- 0x20):(c))

//判断字符是不是10进值的数字
#define DECCHK( c )((c)>='0'&&(c)<='9')

// 判断字符是不是16进值的数字
#define HEXCHK( c )(((c)>='0'&&(c)<='9')||((c)>='A'&&(c)<='F')||((c)>='a'&&(c)<='f'))


// 将__LINE__转为字符串
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define FILE_LINE __FILE__  TOSTRING(__LINE__)


int main(int argc, char *argv[]) {
    (void) argc;
    (void) argv;
    printf("upcase('a')=%c\n", UPCASE('a'));
    printf("DECCHK('0')=%d, DECCHK('a')=%d\n", DECCHK('0'), DECCHK('a'));
    printf("%s:%d (%s %s)\n", __FILE__, __LINE__, __DATE__, __TIME__);


	// 测试2
    printf("\n\nFile and Line: %s\n", FILE_LINE);
    printf("%s:%s\n", __FILE__, TOSTRING(__LINE__));
    return 0;
}
